<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" th:href="@{/layui/css/layui.css}">
    <link th:href="@{/css/semantic.min.css}" rel="stylesheet">
    <script type="text/javascript" th:src="@{/layui/layui.js}"></script>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <script th:src="@{/js/jquery-3.1.1.min.js}"></script>
    <script th:src="@{/js/semantic.min.js}">
    </script>
</head>
<body>
<!--菜单-->
<ul class="layui-nav layui-bg-blue" lay-filter="">
    <li class="layui-nav-item "><a href="/" style="font-size: 20px">首页</a></li>
    <li class="layui-nav-item layui-this">
        <a href="javascript:;" style="font-size: 20px">习题库</a>
        <dl class="layui-nav-child"> <!-- 二级菜单 -->
            <dd>
                <a th:href="@{/item/chapter/overview}">分章节练习</a>
            </dd>
            <dd>
                <a th:href="@{/item/overview}">分题型练习</a>
            </dd>
        </dl>
    </li>
    <li class="layui-nav-item">
        <a href="javascript:;" style="font-size: 20px">课程分类</a>
        <dl class="layui-nav-child"> <!-- 二级菜单 -->
            <dd>
                <a th:href="@{'/course/type_show/'+${coursetype.getId()}}" th:each="coursetype:${coursetypes}" th:text="${coursetype.getCourse_name()}"></a>
            </dd>
            <dd>
                <a th:href="@{/course/type_show/0}" >全部课程</a>
            </dd>
        </dl>
    </li>
    <li class="layui-nav-item" th:if="${session.loginuser} == null"><a th:href="@{/community/index}" style="font-size: 20px">社区</a></li>
    <li class="layui-nav-item " th:if="${session.loginuser} != null">
        <a href="javascript:;" style="font-size: 20px">社区</a>
        <dl class="layui-nav-child">
            <dd><a th:href="@{/community/index}">社区首页</a></dd>
            <dd><a th:href="@{/stu/community/commenting}">发布话题</a></dd>
            <dd><a th:href="@{/stu/community/management}">我的话题</a></dd>
            <dd><a th:href="@{/stu/chat_all}" target="_blank">头脑风暴</a></dd>
        </dl>
    </li>
    <li class="layui-nav-item"><a th:href="@{/file/list}" style="font-size: 20px">资料干货</a></li>

    <!--如果没有登录-->
    <li class="layui-nav-item" th:if="${session.loginuser} == null">
        <a th:href="@{/login}" style="font-size: 20px">登录</a>
    </li>
    <li class="layui-nav-item" th:if="${session.loginuser} == null">
        <a th:href="@{/register}" style="font-size: 20px">注册</a>
    </li>
    <!--如果没有登录-->

    <!--如果登录-->
    <li class="layui-nav-item" th:if="${session.loginuser} != null">
        <a href="javascript:;" style="font-size: 20px">我的班级</a>
        <dl class="layui-nav-child"> <!-- 二级菜单 -->
            <dd>
                <a th:href="@{/stu/map/show}">班级签到</a>
            </dd>
            <dd>
                <a th:href="@{/stu/exam/overview}">班级考试</a>
            </dd>
            <dd>
                <a th:href="@{/stu/exam/mydegree/list}">我的考试成绩</a>
            </dd>
        </dl>
    </li>
    <li class="layui-nav-item" th:if="${session.loginuser} != null">
        <a href="javascript:;" style="font-size: 20px">好友管理</a>
        <dl class="layui-nav-child"> <!-- 二级菜单 -->
            <dd>
                <a th:href="@{/stu/friends/list}">好友列表</a>
            </dd>
            <dd>
                <a th:href="@{/stu/friends/search}">搜索好友</a>
            </dd>
        </dl>
    </li>
    <li class="layui-nav-item" th:if="${session.loginuser} != null">
        <img th:src="@{'/show/'+${session.loginuser.getId()}}" class="layui-nav-img">[[${session.loginuser.username}]]
        <dl class="layui-nav-child">
            <dd><a th:href="@{/stu/center}">个人中心</a></dd>
            <dd><a th:href="@{/stu/logout}">退出</a></dd>
        </dl>
    </li>

    <!--如果登录-->
</ul>
<!--菜单-->
<br>
<div class="ui container" >
    <div class="ui segment">
        <form class="layui-form" method="post"  th:action="@{/item/exam/chapter/submit}">
            <div class="inline  fields" th:each="test,iterStat:${contents}">
                <label  class="ui black header" th:text="'第'+${iterStat.index+1}+'问: '+${test.subject}"></label>
                <br>
                <div class="layui-form-item" th:if="${test.getType_id()==1}">
                    <div class="layui-input-block">
                        <input type="radio"  th:name="${test.id}" value="A" checked="checked" th:title="'A:'+${test.answer_a}">
                    </div>
                </div>
                <div class="layui-form-item" th:if="${test.getType_id()==1}">
                    <div class="layui-input-block">
                        <input type="radio"  th:name="${test.id}" value="B"  th:title="'B:'+${test.answer_b}">
                    </div>
                </div>
                <div class="layui-form-item" th:if="${test.getType_id()==1}">
                    <div class="layui-input-block">
                        <input type="radio"  th:name="${test.id}" value="C"  th:title="'C:'+${test.answer_c}">
                    </div>
                </div>
                <div class="layui-form-item" th:if="${test.getType_id()==1}">
                    <div class="layui-input-block">
                        <input type="radio"  th:name="${test.id}" value="D"  th:title="'D:'+${test.answer_d}">
                    </div>
                </div>
                <div class="layui-form-item" th:if="${test.getType_id()==2}">
                    <div class="layui-input-block">
                        <label  class="ui label"   th:text="'A:'+${test.getAnswer_a()}"/>
                    </div>
                </div>
                <div class="layui-form-item" th:if="${test.getType_id()==2}">
                    <div class="layui-input-block">
                        <label  class="ui label"   th:text="'B:'+${test.getAnswer_b()}"/>
                    </div>
                </div>
                <div class="layui-form-item" th:if="${test.getType_id()==2}">
                    <div class="layui-input-block">
                        <label  class="ui label"   th:text="'C:'+${test.getAnswer_c()}"/>
                    </div>
                </div>
                <div class="layui-form-item" th:if="${test.getType_id()==2}">
                    <div class="layui-input-block">
                        <label  class="ui label"   th:text="'D:'+${test.getAnswer_d()}"/>
                    </div>
                </div>
                <div class="layui-form-item" th:if="${test.type_id==2}">
                    <label class="layui-form-label">回答：</label>
                    <div class="layui-input-block">
                        <select th:name="${test.id}" lay-verify="required" lay-search="">
                            <option value="A,B">A,B</option>
                            <option value="A,C">A,C</option>
                            <option value="A,D">A,D</option>
                            <option value="B,C">B,C</option>
                            <option value="B,D">B,D</option>
                            <option value="C,D">C,D</option>
                            <option value="A,B,C">A,B,C</option>
                            <option value="A,B,D">A,B,D</option>
                            <option value="A,C,D">A,C,D</option>
                            <option value="B,C,D">B,C,D</option>
                            <option value="A,B,C,D">A,B,C,D</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item" th:if="${test.type_id==4}">
                    <label class="layui-form-label">附图[[${iterStat.index+1}]]</label>
                    <div class="layui-input-block">
<!--                        <img class="ui large image" th:src="@{'https://wk2020.oss-cn-shenzhen.aliyuncs.com/'+${test.getImage()}}">-->
                    </div>
                </div>

                <div class="layui-form-item layui-form-text" th:if="${test.type_id==3||test.type_id==4}">
                    <label class="layui-form-label">回答</label>
                    <div class="layui-input-block">
                                <textarea  th:name="${test.id}"   class="layui-textarea" placeholder="请完成答案">
                                </textarea></div>
                </div>

            </div>

            <br>
            <br>
            <br>
            <button class="ui  blue labeled submit icon button" type="submit" >
                <i class="send icon" > </i>
                提交
            </button>
        </form>
    </div>
</div>
</body>
<script>
    layui.use('form', function(){
        var form = layui.form;
        //监听提交
        form.on('submit(formDemo)', function(data){
            layer.msg(JSON.stringify(data.field));
            return false;
        });
    });

    //注意：导航 依赖 element 模块，否则无法进行功能性操作
    layui.use('element', function(){
        var element = layui.element;

        //…
    });
</script>
</html>